<template>
	<section>
		<headers txt="我的积分"></headers>
		<ul v-if="point" class="wallfff mu20 hue333" v-infinite-scroll="points" infinite-scroll-disabled="loading" infinite-scroll-distance="10">
			<li class="bbtm p30" v-for="item in point" style="height: 200px;">
				<p class="flex_between sz28">
					<span>{{item.Flow_Type}}</span>
					<span class="hued44">{{item.Flow_PointsFlow}}</span>
				</p>
				<p class="flex_between hue666">
					<span>{{item.Flow_Time}}</span>
					<span>余额：{{item.Flow_PointsBalance}}</span>
				</p>
			</li>
		</ul>
		<p class="mu50 centre" v-else>没有记录</p>
		<p class="centre pud30" v-if="nones">没有更多了</p>
	</section>
</template>

<script>
	import { InfiniteScroll } from 'mint-ui';
	import { Toast } from 'mint-ui';
	import { Indicator } from 'mint-ui';
	export default {
		data() {
			return {
				point: [],
				PageIndex: 1,
				PageCount: 1,
				nones: false,
				test: [{ //测试
					Flow_Time: "2017-02-13T15:11:22.253",
					Flow_Type: "消费",
					Flow_PointsFlow: "-1111",
					Flow_PointsBalance: "100"
				}]
			}
		},
		methods: {
			points: function() {
				let v = this;
				if(v.PageIndex <= v.PageCount) {
					Indicator.open();
					this.$http.get('/WorkMembersAsset/V1.0/GetMembersFlow', {
						params: {
							"MembersID": this.$store.state.MembersID,
							"PageIndex": v.PageIndex++
						}
					}).then((res) => {
						Indicator.close();
						if(!res.data.Return_ID) {
							let resdata = res.data.Return_Data.PageData;
							if(!resdata || !resdata.length) {
								v.point = null;
								return false;
							}
							resdata.forEach(function(item) {
								item.Flow_Time = item.Flow_Time.replace(/(T|\.\d+)/gim, " ");
								v.point.push(item);
							});
							v.PageCount = res.data.Return_Data.PageCount;
						} else {
							Toast(res.data.Return_Mess);
						}

					}).catch((err) => {
						Indicator.close();
					});
				} else {
					v.nones = true;
				}
			},
		},
	}
</script>

<style>

</style>